package model

import (
	"gorm.io/gorm"
	"time"
)

// 患者结构体
type Patient struct {
	gorm.Model
	Patient_name   string `json:"patient_name" gorm:"type:varchar(12)"`
	Patient_number int64  `json:"patient_number" gorm:"primaryKey,autoIncrement"`
	Patient_sex    string `json:"patient_sex" gorm:"type:varchar(3)"`
	Patient_age    int64  `json:"patient_age" gorm:"type:int(1)"`
	//Patient_department string  `json:"patient_department" gorm:"type:varchar(100)"`
	Patient_idCard   string `json:"patient_idCard" gorm:"type:varchar(100)"`
	Patient_birthday string `json:"patient_birthday" gorm:"type:varchar(100)"`
	//Patient_docket    string  `json:"Patient_docket" gorm:"type:varchar(20)"`
	Patient_phone     int64   `json:"Patient_phone" gorm:"type:varchar(11)"`
	Patient_address   string  `json:"Patient_address" gorm:"type:varchar(200)"`
	Patient_vip       int     `json:"Patient_vip" gorm:"type:tinyint(1)"`
	Patient_insurance int     `json:"Patient_insurance" gorm:"type:tinyint(1)"`
	Patient_balance   float64 `json:"Patient_balance" gorm:"type:double(10,2)"`
}

// 医师结构体
type Docket struct {
	gorm.Model
	Name              string  `json:"name" gorm:"type:varchar(12)"`
	Age               int64   `json:"age" gorm:"type:int(1)"`
	Qualification     *int    `json:"qualification" gorm:"type:tinyint(1)"`
	Score             *int    `json:"score" gorm:"type:tinyint(1)"`
	Expert            *int    `json:"expert" gorm:"type:tinyint(1)"`
	Docket_address    string  `json:"docket_address" gorm:"type:varchar(100)"`
	Docket_department *int    `json:"docket_department" gorm:"type:int(100)"`
	Price             float64 `json:"price" gorm:"type:double(10,2)"`
}

// 挂号结构体
type Register struct {
	gorm.Model

	Pat_id     int    `gorm:"type:int(100)"`
	Doc_id     int    `gorm:"type:int(100)"`
	Start_time string `gorm:"column:start_time;type:varchar(100)"`
	End_time   string `gorm:"column:end_time;type:varchar(100)"`
	Date       string `gorm:"column:date;type:date"`
	//Register_date string `json:"patient_birthday" gorm:"type:date"`
}

// 挂号查询结构体
type RegisterSel struct {
	Doc_id int    `gorm:"type:int(100)"`
	Date   string `gorm:"column:date;type:date"`
	//Register_date string `json:"patient_birthday" gorm:"type:date"`
}

// 挂号查询接受查询结果结构体
type Reg struct {
	Date      string
	StartTime string
	EndTime   string
}

// // 挂号结构体接受医生患者
type DocPat struct {
	gorm.Model
	Pat_id    int       `gorm:"type:int(100)"`
	Doc_id    int       `gorm:"type:int(100)"`
	startTime time.Time `gorm:"column:start_time;type:datetime"`
	endTime   time.Time `gorm:"column:end_time;type:datetime"`
}

// 科室结构体
type Department struct {
	gorm.Model
	Name    string `json:"name" gorm:"type:varchar(100)"`
	Address string `json:"address" gorm:"type:varchar(100)"`
}

// 科室与医师绑定关系
type DepDoc struct {
	gorm.Model
	Doc_id uint `json:"doc_id" gorm:"type:int(100)"`
	Dep_id *int `json:"dep_id" gorm:"type:int(100)"`
}

// 医师查询
type DepDocSel struct {
	Name          string
	Dep_id        *int
	Expert        *int
	Qualification *int
}

// 房间管理
type RoomMang struct {
	gorm.Model
	RoomId int  `gorm:"primaryKEY;autoIncrement"` //房间号
	IsVip  uint `gorm:"type:int(1)"`
}

// 新增药品
type Drug struct {
	gorm.Model
	Name               string  `gorm:"type:varchar(100)"`
	Price              float64 `gorm:"type:decimal(10,2)"`
	IndicativeFunction string  `gorm:"type:varchar(100)"`
	Inventory          int     `gorm:"type:int(200)"`
	Term               int     `gorm:"type:int(100)""`
}

// 诊疗结果
type Result struct {
	gorm.Model
	DocketId           int    `gorm:"type:int(100)"`
	DoctorName         string `gorm:"type:varchar(100)"`
	PatientId          int    `gorm:"type:int(100)"`
	PatientName        string `gorm:"type:varchar(100)"`
	Department         *int   `gorm:"type:varchar(100)"`
	PatientSex         string `gorm:"type:varchar(10)"`
	PatientIDcard      string `gorm:"type:varchar(100)"`
	PatientAge         int64  `gorm:"type:int(100)"`
	SymptomDescription string `gorm:"type:varchar(100)"`
	Diagnosis          string `gorm:"type:varchar(100)"`
	IsHospital         string `gorm:"type:varchar(100)"`
	HospitalStay       string `gorm:"type:varchar(100)"`
}

// 药品和结果关联关系
type DrugList struct {
	gorm.Model
	DrugId   uint `gorm:"type:bigint(20)"`
	ResultId uint `gorm:"type:bigint(20)"`
	Number   int  `gorm:"type:int(100)"`
}

// 房间新增
type Room struct {
	gorm.Model
	Name       string `gorm:"type:varchar(100)"`
	IsVip      bool   `gorm:"type:boolean"`
	NumberBeds int    `gorm:"type:int(100)"`
	Address    string `gorm:"type:varchar(100)"`
}

// 床位信息
type Bed struct {
	gorm.Model
	Name        string `gorm:"type:varchar(100)"`
	PatientId   int    `gorm:"type:int(100)"`
	PatientName string `gorm:"type:varchar(100)"`
	RoomId      uint   `gorm:"type:varchar(100)"`
}

// 住院办理
type InpatientInquiry struct {
	gorm.Model
	PatId     int    `gorm:"type:bigint(100)"`
	PatName   string `gorm:"type:varchar(100)"`
	PatAge    int64  `gorm:"type:int(100)"`
	Diagnosis string `gorm:"type:varchar(100)"`
	RoomId    int    `gorm:"type:int(100)"`
	StartTime string `gorm:"type:varchar(100)"`
	EndTime   string `gorm:"type:varchar(100)"`
}

// 注册结构体
type RegisterText struct {
	gorm.Model
	Username string `gorm:"type:varchar(20)"`
	Password string `gorm:"type:varchar(20)"`
}
